package com.example.aidldemo.lib

import android.content.Context
import android.util.DisplayMetrics
import android.view.WindowManager
import androidx.appcompat.app.AppCompatActivity

object Util {

    @JvmStatic
    fun getScreenWidth(context: Context): Int {
        val windowManager = context.getSystemService(AppCompatActivity.WINDOW_SERVICE) as WindowManager
        val metrics = DisplayMetrics()
        windowManager.defaultDisplay.getMetrics(metrics)
        return metrics.widthPixels
    }
}